package com.group3.pojo.result;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.group3.domain.Leave;
import com.group3.domain.LeaveDetail;
import com.group3.domain.LeaveOperationRecord;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

import java.util.Date;
import java.util.List;

/**
 * LeaveDetail
 *
 * @author HY
 * 2021/06/07 16:19
 **/

@Data
@ToString
@ApiModel("请假详情返回类")
public class LeaveDetailResult {

//    @ApiModelProperty(value = "请假id")
//    private Integer leaveId;
//
//    @ApiModelProperty(value = "请假原因")
//    private String reason;
//
//    @ApiModelProperty(value = "请假主题")
//    private String theme;
//
//    @ApiModelProperty(value = "请假开始时间")
//    private Date startLeaveTime;
//
//    @ApiModelProperty(value = "请假结束时间")
//    private Date endLeaveTime;
//
//    @ApiModelProperty(value = "请假类型")
//    private Integer type;
//
//    @ApiModelProperty(value = "审批状态")
//    private Integer state;

    @ApiModelProperty(value = "请假id")
    private Integer leaveId;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
    @ApiModelProperty(value = "提交时间")
    private Date submitTime;

    @ApiModelProperty(value = "学院")
    private String departName;

    @ApiModelProperty(value = "专业")
    private String professionName;

    @ApiModelProperty(value = "年级")
    private String grade;

    @ApiModelProperty(value = "班级id")
    private String classId;

    @ApiModelProperty(value = "学生学号")
    private String studentId;

    @ApiModelProperty(value = "学生姓名")
    private String studentName;

    @ApiModelProperty(value = "请假主题")
    private String theme;

    @ApiModelProperty(value = "请假类型")
    private Integer type;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
    @ApiModelProperty(value = "请假开始时间")
    private Date startLeaveTime;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
    @ApiModelProperty(value = "请假结束时间")
    private Date endLeaveTime;

    @ApiModelProperty(value = "审批状态")
    private Integer state;

    @ApiModelProperty(value = "教师工号")
    private String teacherId;

    @ApiModelProperty(value = "教师名字")
    private String teacherName;

    @ApiModelProperty(value = "请假原因")
    private String reason;

    @ApiModelProperty(value = "请假类型Str")
    private String typeStr;

    @ApiModelProperty(value = "审批状态Str")
    private String stateStr;

    public String getTypeStr() {
        switch (type){
//            0（未审批），1（未通过审批），2（通过审批）；
            case 0:return "未审批";
            case 1:return "未通过审批";
            case 2:return "通过审批";
        }
        return "?";
    }


    public String getStateStr() {
        switch (state){
//            0:事假；1：病假；2：公假
            case 0:return "事假";
            case 1:return "病假";
            case 2:return "公假";
        }
        return "?";
    }

    @ApiModelProperty(value = "附件名")
    private List<String> attachments;

    @ApiModelProperty(value = "操作记录")
    private List<LeaveOperationRecord> leaveOperationRecords;

}
